open Repertoire
open Printf


let _ =

print_endline "\nadd_list 4 [1;2;3;5] 0.5p";
let add = add_list 4 [1;2;3;5] in
List.iter (fun x -> print_endline (string_of_int x)) add;

print_endline "\nadd_list 4 [1;2;3;4;5] 0.5p";
let add = add_list 4 [1;2;3;4;5] in
List.iter (fun x -> print_endline (string_of_int x)) add;


print_endline "\nremove_list 4 [1;2;3;4;5] 1p";
let rm = remove_list 4 [1;2;3;4;5] in
List.iter (fun x -> print_endline (string_of_int x)) rm;

print_endline "\nexist 4 [1;2;3;5] 0.5p";
let ex = exist 4 [1;2;3;5] in
print_endline (string_of_bool ex);

print_endline "\nexist 4 [1;2;3;4;5] 0.5p";
let ex = exist 4 [1;2;3;4;5] in
print_endline (string_of_bool ex);

print_endline "\nmap (function x -> x + 1) [1;3;5;7;11] 1p";
let mp = map (function x -> x + 1) [1;3;5;7;11] in
List.iter (fun x -> print_endline (string_of_int x)) mp;

print_endline "\niter (print_int) [1;3;5;7;11] 1p";
iter (fun x -> print_endline (string_of_int x)) [1;3;5;7;11];
List.iter (fun x -> print_endline (string_of_int x)) [1;3;5;7;11];

print_endline "\nfor_all (function x -> x = 0) [0;0;0;0;0] 1p";
let fa = for_all (function x -> x = 0) [0;0;0;0;0] in
print_endline (string_of_bool fa);

let string_of_char c = 
    String.make 1 c in

print_endline "\nupper_case 'c' 0.25p";
let c = upper_case 'c' in 
print_endline (string_of_char c);

print_endline "\nupper_case 'C' 0.25p";
let c = upper_case 'C' in
print_endline (string_of_char c);

print_endline "\nlower_case 'C' 0.25p";
let c = lower_case 'C' in
print_endline (string_of_char c);

print_endline "\nlower_case 'c' 0.25p";
let c = lower_case 'c' in
print_endline (string_of_char c);

print_endline "\nstring_uppercase Hello 0.75p";
let str = string_uppercase "Hello" in
print_endline str;

print_endline "\nstring_uppercase HELLO 0.75p";
let str = string_uppercase "HELLO" in
print_endline str;

print_endline "\nstring_lowercase Hello 0.75p";
let str = string_lowercase "Hello" in
print_endline str;

print_endline "\nstring_lowercase hello 0.75p";
let str = string_lowercase "hello" in
print_endline str;

print_endline "\nl = [KrisBoul;JuNioR;TheneDiel;YoLo;2Pac;LegoLas]";
let l = ["KrisBoul";"JuNioR";"TheneDiel";"YoLo";"2Pac";"LegoLas"] in
print_endline "\nmap convert_first_maj l 2p";
let lfirst_maj = map convert_first_maj l in
List.iter print_endline lfirst_maj;


let my_print_contact contact = 
	let (name, age, adress, tel) = contact in
	print_endline 
    ("name : "^name^"  age : "^(string_of_int age)^"  adress : "^adress^
    "  tel : "^(string_of_int tel)) in

print_endline "\nlet theo = create_contact (THEO, 20, 87 rue Damremont,0652302185) 1p";
let theo = create_contact ("THEO", 20, "87 rue Damremont", 0652302185) in
my_print_contact theo;
print_endline "\nlet krisboul = create_contact (KrisBoul, 42, EPITA VJ, 0642424242)";
let krisboul = create_contact ("KrisBoul", 42, "EPITA VJ", 0642424242) in
my_print_contact krisboul;
print_endline "\nlet junior = create_contact (JUnioR, 42, EPITA VJ, 0641414141)";
let junior = create_contact ("JUnioR", 42, "EPITA VJ", 0641414141) in
my_print_contact junior;

print_endline "\nlet ag = add_contact theo [] 0.5p";
let ag = add_contact theo [] in
List.iter my_print_contact ag;
print_endline "\nlet ag = add_contact krisboul ag";
let ag = add_contact krisboul ag in
List.iter my_print_contact ag;
print_endline "\nlet ag = add_contact junior ag";
let ag = add_contact junior ag in
List.iter my_print_contact ag
